package com.xtsoft.platform.task.domain;

/*
*    上海信拓信息技术有限公司  
*    Copyright (C) ShangHai XinTuo Software Inc.
*/

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;

import jakarta.persistence.*;
import org.apache.commons.lang3.builder.ToStringBuilder;

import org.hibernate.annotations.GenericGenerator;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.xtsoft.core.entity.GenericEntity;



/**
 * InfTask Base Java Bean, base class for the model, mapped directly to database
 * table
 * 
 * Avoid changing this file if not necessary, will be overwritten.
 *
 * 项目和任务记录，以isProject区分
 */
@Entity
@Table(name = "inf_task")
@Data
public class InfTask extends GenericEntity {

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name = "infTaskId", nullable = false, length = 32)
	private String infTaskId;

	/**
	 * 任务编码
	 */
	@Column(name = "nodeId", nullable = false, length = 32)
	private String nodeId;

	/**
	 * 上级任务编码
	 */
	@Column(name = "parentNodeId", nullable = false, length = 32)
	private String parentNodeId;

	/**
	 * 任务名称
	 */
	@Column(name = "taskName", nullable = false, length = 128)
	private String taskName;

	/**
	 * 版本号
	 */
	@Column(name = "version", nullable = true, length = 24)
	private String version;

	@Column(name = "userId", nullable = true, length = 24)
	private String userId;
	
	/**
	 * 客户
	 */
	@Column(name = "customer", nullable = true, length = 128)
	private String customer;

	/**
	 * 计划开始日期
	 */
	// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	// //若需要精确时间，可开放该注解，注释掉下一行注解
	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
	@Column(name="planStartDate",nullable=true, length=19 )
	private Date planStartDate;

	/**
	 * 计划完成日期
	 */
	// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	// //若需要精确时间，可开放该注解，注释掉下一行注解
	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
	@Column(name="planEndDate",nullable=true, length=19 )
	private Date planEndDate;

	/**
	 * 实际完成日期
	 */
	// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	// //若需要精确时间，可开放该注解，注释掉下一行注解
	@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
	@Column(name="realEndDate",nullable=true, length=19 )
	private Date realEndDate;

	/**
	 * 是否延期
	 */
	@Column(name = "isDelayed", nullable = true, length = 10)
	private Integer isDelayed;

	/**
	 * 关键字
	 */
	@Column(name = "keyword", nullable = true, length = 128)
	private String keyword;

	/**
	 * 任务类型
	 */
	@Column(name = "taskType", nullable = true, length = 10)
	private Integer taskType;

	/**
	 * 状态
	 */
	@Column(name = "state", nullable = false, length = 10)
	private Integer state;

	/**
	 * 排序
	 */
	@Column(name = "recordSort", nullable = true, length = 10)
	private Integer recordSort;

	/**
	 * 是否项目
	 */
	@Column(name = "isProject", nullable = false, length = 10)
	private Integer isProject;

	/**
	 * 追溯ID
	 */
	@Column(name = "reviewId", nullable = true, length = 32)
	private String reviewId;



	/**
	 * 项目代码
	 */
	@Column(name = "projectCode", nullable = true, length = 24)
	private String projectCode;

	/**
	 * 说明
	 */
	@Lob
	@Column(name = "descript", nullable = true)
	private String descript;
	
	/**
	 * 更新用户
	 */
	@Column(name="updateUserId",nullable = false,length = 32)
	private String updateUserId;
	
	
	/**
	 * 更新用户名
	 */
	@Column(name="username",nullable = false,length = 128)
	private String username;
	
	
	/**
	 * 更新时间
	 */
	@Column(name = "updateTime",nullable=false)
	private  long  updateTime;
	
	/**
	 * 任务摘要
	 */
	@Column(name="summary",nullable=true,length=64)
	private String summary;

	/**
	 * Sysorgnize
	 */

	@Column(name = "organizeId", nullable = false, length = 32)
	private String organizeId;

	/**
	 * importedKeys

	@ManyToOne
	@JoinColumn(name = "organizeId")
	private SysOrganize sysOrganize;
	 */


	/**
	 * 计算任务缺陷
	 */
	private String taskBug;
	
	/**
	 * 任务点评数量
	 */
	private String taskCommitSize;
	/**
	 * 图标显示
	 */
	private String icon;

	/**
	 *
删除一对多关联
	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "infTask")
	@JsonIgnore
	private List<ProjectDeploy> projectDeploys = new ArrayList<>();

	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.LAZY, mappedBy = "infTask")
	@JsonIgnore
	private List<TaskBug> taskBugs = new ArrayList<>();
	
	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.LAZY, mappedBy = "infTask")
	@JsonIgnore
	private List<TaskComment> taskComment = new ArrayList<>();

	 */
	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.LAZY, mappedBy = "infTask")
	@JsonIgnore
	private List<TaskComment> taskComment = new ArrayList<>();

	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.LAZY, mappedBy = "infTask")
	@JsonIgnore
	private List<TaskBug> taskBugs = new ArrayList<>();


	/**
	 * 默认构造
	 */
	public InfTask() {

	}

	/**
	 * 构造方法，自动测试使用，把除主键外的所有非空字段赋值
	 *
	 * 也可作普通使用 调用该构造方法时，字串参数填或不填均 可，该带参构造方法仅为区别Lombok自动生成的默认构造方 法。
	 * 
	 * 应用程序可根据需要修改该构造方法中的非空属性赋值。删除了
	 **/


	/**
	 * @see Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("infTaskId", this.infTaskId).append("nodeId", this.nodeId)
				.append("parentNodeId", this.parentNodeId).append("taskName", this.taskName)
				.append("version", this.version).append("userId", this.userId).append("customer", this.customer)
				.append("planStartDate", this.planStartDate).append("planEndDate", this.planEndDate)
				.append("realEndDate", this.realEndDate).append("isDelayed", this.isDelayed)
				.append("keyword", this.keyword).append("taskType", this.taskType).append("state", this.state)
				.append("recordSort", this.recordSort).append("isProject", this.isProject)
				.append("reviewId", this.reviewId)
				.append("projectCode", this.projectCode)
				.append("descript", this.descript).toString();
	}

	/**
	 * 以实体类主键生成HASHCODE
	 */
	@Override
	public int hashCode() {
		return this.infTaskId.hashCode();
	}

	/**
	 * 以实体类主键比较对象是否相等
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof InfTask) {
			return this.infTaskId.equals(((InfTask) obj).getInfTaskId());
		}
		return false;
	}

}
